//
//  FKHomeCategoryItemCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/3/16.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKHomeCategoryItemCell.h"
#import "FKCustomBtn.h"
#import <UIButton+WebCache.h>

@interface FKHomeCategoryItemCell ()

@property (nonatomic, weak) UIImageView *iconView;
@property (nonatomic, weak) UILabel *titleLabel;

@end

@implementation FKHomeCategoryItemCell

- (void)setupSubviews
{
    [super setupSubviews];
    
    UIImageView *iconView = [[UIImageView alloc] init];
    [self.contentView addSubview:iconView];
    self.iconView = iconView;
    
    UILabel *titleLabel = [UILabel fk_labelWithFont:fk_adjustFont(12) textColor:fkColor333333];
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(fk_adjustW(38));
        make.centerX.offset(0);
        make.top.offset(fk_adjustW(12));
    }];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.offset(fk_adjustW(-12));
        make.centerX.equalTo(iconView);
    }];
}

- (void)itemBtnClicked:(FKCustomBtn *)btn
{
    
}

- (void)setData:(id)data
{
    [super setData:data];
    
    self.titleLabel.text = data[@"name"];
//    NSString *url = fkFORMAT(@"%@%@", HostURL, data[@"img"]);
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:data[@"img"]] placeholderImage:nil];
}

@end
